// function mySetInterval(fn, timeout) {
//   // 控制器，控制定时器是否继续执行
//   var timer = {
//     flag: true
//   };

//   // 设置递归函数，模拟定时器执行。
//   function interval() {
//     if (timer.flag) {
//       fn();
//       setTimeout(interval, timeout);
//     }
//   }

//   // 启动定时器
//   setTimeout(interval, timeout);

//   // 返回控制器
//   return timer;
// }

// mySetInterval(() => {
//   console.log('log······')
// }, 1000)





class Person {
  constructor(name) {
    this.name = name
  }
  printName() {
    console.log(this.name)
  }
}

class Student extends Person {
  constructor(score, ...args) {
    super(...args)
    this.score = score
  }
  printScore() {
    console.log(this.score)
  }
}

Person.prototype.showContent = function() {
  console.log(this.name, this.score)
}

const s1 = new Student("xxx", 23)

s1.showContent()


function useState(initialValue) {
  _state = _state || initialValue
  function setState(newState) {
    _state = newState
    render()
  }
  return [_state, setState]
}

const button = (props) => {
  const { text, type, size, disabled, handleClick } = props
  const classname = classname({
    btn: true,
    "btn-small": size === "small",
    "btn-large": size === "large"
  })
  return <button
      onClick = {handleClick}
      classname={classname}
      disabled={disabled}
    >{ text }
    </button>
}